#include "stdafx.h"
#include "OgreSceneNodeMovingEffector.h"

VWD::OgreSceneNodeMovingEffector::OgreSceneNodeMovingEffector( Ogre::SceneNode* controlTarget,double stepLength)
:target(controlTarget),step(stepLength)
{

}

VWD::OgreSceneNodeMovingEffector::~OgreSceneNodeMovingEffector(void)
{
}

void VWD::OgreSceneNodeMovingEffector::MoveForward()
{
	target->translate(0,0,-step,Ogre::Node::TransformSpace::TS_LOCAL);
}

void VWD::OgreSceneNodeMovingEffector::MoveBack()
{
	target->translate(0,0,step,Ogre::Node::TransformSpace::TS_LOCAL);
}

void VWD::OgreSceneNodeMovingEffector::MoveUp()
{
	target->translate(0,step,0,Ogre::Node::TransformSpace::TS_LOCAL);
}

void VWD::OgreSceneNodeMovingEffector::MoveDown()
{
	target->translate(0,-step,0,Ogre::Node::TransformSpace::TS_LOCAL);
}

void VWD::OgreSceneNodeMovingEffector::ShiftLeft()
{
	target->translate(-step,0,0,Ogre::Node::TransformSpace::TS_LOCAL);
}

void VWD::OgreSceneNodeMovingEffector::ShiftRight()
{
	target->translate(step,0,0,Ogre::Node::TransformSpace::TS_LOCAL);
}

void VWD::OgreSceneNodeMovingEffector::Yaw( int rate )
{		
	target->yaw(Ogre::Radian(Ogre::Degree(rate)));
}

void VWD::OgreSceneNodeMovingEffector::Pitch( int rate )
{
	target->pitch(Ogre::Radian(Ogre::Degree(rate)));
}

void VWD::OgreSceneNodeMovingEffector::Roll( int rate )
{
	target->roll(Ogre::Radian(Ogre::Degree(rate)));
}

double VWD::OgreSceneNodeMovingEffector::GetStep() const
{
	return step;
}

void VWD::OgreSceneNodeMovingEffector::SetStep( double val )
{
	step = val;
}

void VWD::OgreSceneNodeMovingEffector::RotateHorizon( int rate )
{	
	target->yaw(Ogre::Radian(Ogre::Degree(rate)),Ogre::Node::TransformSpace::TS_PARENT);
}

void VWD::OgreSceneNodeMovingEffector::RotateVertical( int rate )
{
	target->pitch(Ogre::Radian(Ogre::Degree(rate)));
	//target->rotate(Ogre::Vector3::NEGATIVE_UNIT_X,Ogre::Radian(Ogre::Degree(rate)));
}